import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop0016_删除前台侧边流程"
#1.打开后台 登录
firfox=openBrowser(urlAdmin)
DBshopLoginAdmin(firfox)
#2.点击商品管理 管理分类 前台侧边设置
time.sleep(1)
DBshopEnterMenu3(firfox,"商品管理","管理分类","前台侧边设置")
#点击删除
firfox.find_element_by_xpath('//td[contains(.,"网站很好看")]/following-sibling::td[3]/a[2]').click()

firfox.switch_to.alert.accept()#JS弹框确认
time.sleep(1)
#断言
try:
    firfox.find_element_by_xpath('//td[contains(.,"网站很好看")]').is_displayed()
    writeLog("%s 测试失败" % testCase)
    getPhoto(firfox)
except:
    writeLog("%s 测试成功" % testCase)
firfox.quit()